jQuery(document).ready(function(){
	window.console && console.log(js_locations);

	var myOptions = {
			center: new google.maps.LatLng(41.850033, -87.6500523),
			zoom: 12,
			mapTypeId: google.maps.MapTypeId.ROADMAP
	};

	var map = new google.maps.Map(document.getElementById("map"), myOptions);
	var addressArray = js_locations;
	var geocoder = new google.maps.Geocoder();

	var markerBounds = new google.maps.LatLngBounds();

	for (var i = 0; i < addressArray.length; i++) {
		geocoder.geocode( { 'address': addressArray[i]}, function(results, status) {
			if (status == google.maps.GeocoderStatus.OK) {
				var marker = new google.maps.Marker({
					map: map,
					position: results[0].geometry.location
				});
				markerBounds.extend(results[0].geometry.location);
				map.fitBounds(markerBounds);
			} else if(status == "OVER_QUERY_LIMIT") {
				setTimeout(function() {;}, 2000);
			} else {
				window.console && console.error("Geocode was not successful for the following reason: " + status);
			}
		});
	}

});
